Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Started ignoring remote keyboard notifications.#17981

Merged
gaaclarke merged 2 commits into
flutter-team-archive:masterfrom
gaaclarke:ignore-remote-keyboard-notification
Apr 28, 2020
Merged

Started ignoring remote keyboard notifications.#17981
gaaclarke merged 2 commits into
flutter-team-archive:masterfrom
gaaclarke:ignore-remote-keyboard-notification

Conversation

@gaaclarke

Copy link
Copy Markdown
Contributor

Relevant issue: flutter/flutter#55624
This is a more stable alternative to #16270

@chinmaygarde chinmaygarde left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment about being more defensive against missing keys. Rest lgtm.


if (@available(iOS 9, *)) {
// Ignore keyboard notifications related to other apps.
if (![info[UIKeyboardIsLocalUserInfoKey] boolValue]) {

@chinmaygarde chinmaygarde Apr 27, 2020

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find guidance in the documentation on whether this key will always be present. The discussion in the docs seems to be around multitasking on iPad. As it stands, if the key is not present in the dictionary, the frame change will be ignored. A more defensive writing of this piece of code would be to check if the key exists and then check its bool value. If the key doesn't exist, process the frame change as normal.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. In practice it isn't just iPad, these were the very notifications that were messing us up and I was testing with iPhone. I believe the key is always present (except iOS 8). It doesn't hurt to make it safer.

@gaaclarke

Copy link
Copy Markdown
Contributor Author

@gaaclarke gaaclarke merged commit 5f437fb into flutter-team-archive:master Apr 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Development

Successfully merging this pull request may close these issues.

3 participants